home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4367 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.8 KB  |  77 lines

  1. Path: news.compuserve.com!newsmaster
  2. From: Mike Davies <100717.2065@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Borland Turbo C++
  5. Date: Mon, 29 Jan 1996 23:40:43 -0800
  6. Organization: CompuServe Incorporated
  7. Message-ID: <310DCB7B.586@compuserve.com>
  8. NNTP-Posting-Host: hd34-135.compuserve.com
  9. Mime-Version: 1.0
  10. Content-Type: multipart/mixed; boundary="------------1FE43FA141F3"
  11. X-Mailer: Mozilla 2.0b6a (Win16; I)
  12.  
  13. This is a multi-part message in MIME format.
  14.  
  15. --------------1FE43FA141F3
  16. Content-Type: text/plain; charset=us-ascii
  17. Content-Transfer-Encoding: 7bit
  18.  
  19. Help!!!
  20.  
  21. I am using Borland Turbo C++ 3.1 under Windows 3.1 and am having serious 
  22. trouble getting the attached program to run with the desired output.
  23.  
  24. It compiles without error and runs to end, BUT the output to screen is 
  25. all in BLACK not RED as is the purpose of the progam.
  26.  
  27. If anyone knows what the problem may be - please let me know as this has 
  28. been driving me mad for a number of weeks.
  29.  
  30.  
  31. Thanks.
  32.  
  33. Mike
  34.  
  35. EMAIL: 100717.2065@compuserve.com
  36.  or    Mike_Davies@compuserve.com
  37.  
  38. --------------1FE43FA141F3
  39. Content-Type: text/plain; charset=us-ascii
  40. Content-Transfer-Encoding: 7bit
  41. Content-Disposition: inline; filename="TEXTCOL.C"
  42.  
  43.  
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <windows.h>
  47.  
  48. /*****************************************************************************/
  49.  
  50. void main(void)
  51.     {
  52.     HDC hdcIC;
  53.     COLORREF colref;
  54.     
  55.     if((hdcIC = GetDC(NULL))==NULL)
  56.         {
  57.         strerror(errno);
  58.         exit(1);
  59.         }
  60.  
  61.     colref = GetTextColor(hdcIC);
  62.     printf("\n\ncolref = %d (black)", colref);
  63.  
  64.     SetTextColor(hdcIC, RGB(255, 0, 0));     /* sets color to red  */
  65.    
  66.     colref = GetTextColor(hdcIC);
  67.     printf("\n\ncolref = %d (red)", colref);
  68.  
  69.     ReleaseDC(NULL, hdcIC);
  70.  
  71.     exit(0);
  72.     }
  73.  
  74. /*****************************************************************************/
  75. --------------1FE43FA141F3--
  76.  
  77.